<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,
com.brother.model.*,com.brother.service.*,com.ibatis.common.util.PaginatedList"   pageEncoding="UTF-8"%>
<jsp:useBean id="reportService" class="com.brother.service.ReportService"></jsp:useBean>
<%
String reportId = request.getParameter("reportId");
String action = request.getParameter("action");
String comment = request.getParameter("comment");
if(reportId == null){
	reportId = "0";
}

if(action != null && action.equals("modify")){
	Report r = new Report();
	r.setReportId(Integer.parseInt(reportId));
	comment = comment.replaceAll("'","\\'");
	r.setComment(comment);
	reportService.updateReport(r);
}
if(comment == null){
	Report report = new Report();
	report.setReportId(Integer.parseInt(reportId));
	PaginatedList pageData = reportService.findData("0",1,report);
	
	if(!pageData.isEmpty()){
		comment = ((Report)pageData.get(0)).getComment();
	}
	if(comment == null){
		comment = "";
	}
	
}

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Comment</title>
<link rel="stylesheet" type="text/css" media="all" href="./style.css">
</head>
<body>
<br><br>
<center>
<form method="post" action="gps_comment.jsp">
  <table width="300" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><textarea style="font-size:14px" name="comment" cols="50" rows="10" id="comment"><%=comment %></textarea></td>
    </tr>
    <tr>
      <td><input type="submit" name="Submit" value="Modify">
      <input type=hidden value="modify" name="action"/>
      <input type=hidden value="<%=reportId%>" name="reportId"/>
      
      </td>
    </tr>
  </table>

</form></center>
</body>
</html>
<%
com.brother.database.DataBase.closeThreadConnection();
%>